#pragma once

#include <windows.h>
#include <cstdio>
#include <conio.h>

enum arrowKeys
{
	eArrowHit = 224,
	eArrowUp = 72,
	eArrowRight = 77,
	eArrowDown = 80,
	eArrowLeft = 75,
};

int absVal(int a_num);

struct Position
{
	int x, y;
	Position(int x, int y):x(x),y(y){}
	Position():x(0),y(0){}
	void setConsole()
	{
		COORD p = {x, y};
		SetConsoleCursorPosition(
			GetStdHandle(STD_OUTPUT_HANDLE), p);
	}

	void add(Position a_add){

		x += a_add.getX();
		y += a_add.getY();
	}

	int getX(){return x;}
	int getY(){return y;}

	void useInput(unsigned char input)
	{
		if(input == eArrowHit)
			input = _getch();
		switch(input)
		{
		case eArrowUp:
		case 'w':	y--;	break;
		case eArrowLeft:
		case 'a':	x--;	break;
		case eArrowDown:
		case 's':	y++;	break;
		case eArrowRight:
		case 'd':	x++;	break;
		}
	}
};

